package controllers

import (
	"time"

	"face/models"
	"github.com/astaxie/beego"
)

type VisitorListController struct {
	beego.Controller
}

func (c *VisitorListController) Get() {

	nowTime := time.Now().Unix()
	// t := new(models.Face)
	// t.FaceAddId = "17233b4b1b51ac91e391e5afe130eb78"
	// t.FaceId = 1
	// t.FaceUrl = "http://appnodebyyang.qiniudn.com/ct2.jpg"
	// t.CreateTime = nowTime
	// models.Engine.Insert(t)

	face := make([]*models.Face, 0, 10)
	models.Engine.Where("create_time > ?", nowTime-24*60*60).Find(&face)

	c.Data["json"] = map[string]interface{}{"Visitor": face}
	c.ServeJson()
}
